import java.util.ArrayList;
import java.util.List;

/**
 * Department 类（系）：
 * 约束：至少拥有 1 位指导教师；提供至少 1 门课程。
 * 组合关系：School 拥有 Department (通过 School 类管理)
 */
public class Department {
    private String name;
    // 关联：至少 1 位指导教师 (多重性 1..*)
    private List<Instructor> instructors; 
    // 关联：提供至少 1 门课程 (多重性 1..*)
    private List<Subject> subjects; 

    public Department(String name) {
        this.name = name;
        this.instructors = new ArrayList<>();
        this.subjects = new ArrayList<>();
    }
    
    public void addInstructor(Instructor instructor) {
        this.instructors.add(instructor);
    }
    
    public void addSubject(Subject subject) {
        this.subjects.add(subject);
    }
    
    // 验证方法：确保满足最小约束
    public boolean isValid() {
        return instructors.size() >= 1 && subjects.size() >= 1;
    }

    public String getName() {
        return name;
    }
    
    public List<Instructor> getInstructors() {
        return instructors;
    }
    
    public List<Subject> getSubjects() {
        return subjects;
    }
}